package com.chenliang.service.impl;

import com.chenliang.dao.Idao;
import com.chenliang.domain.Product;
import com.chenliang.service.IService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ProjectName: mavenSSM
 * @Package: com.chenliang.service.impl
 * 作用：
 */
@Service
public class ServiceImpl implements IService{
    @Autowired
    private Idao productdao;

    @Override
    public List<Product> findall(Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);
      return   productdao.findAll();
    }


    @Override
    @Transactional
    public void addProduct(Product product) {


        productdao.addProduct(product);
    }

    @Override
    @Transactional
    public void delMethod(String[] ids) {
        for (String id : ids) {
            productdao.delMethod(id);
        }
    }
}
